
<template>
  <div>
    <el-dialog
      v-model="conf.aah_visible"
      title="重置"
      width="30%"
      draggable
      :before-close="hide_aah"
    >
      <span
        >确认重置( 姓名:<span
          v-text="form_aah.full_name"
        ></span
        >) 吗?</span
      >
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="hide_aah">取消</el-button>
          <el-button type="primary" @click="save_aah">提交</el-button>
        </span>
      </template>
    </el-dialog><el-dialog
      v-model="conf.aai_visible"
      title="解锁"
      width="30%"
      draggable
      :before-close="hide_aai"
    >
      <span
        >确认解锁( 姓名:<span
          v-text="form_aai.full_name"
        ></span
        >) 吗?</span
      >
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="hide_aai">取消</el-button>
          <el-button type="primary" @click="save_aai">提交</el-button>
        </span>
      </template>
    </el-dialog><el-dialog
      v-model="conf.aak_visible"
      title="删除"
      width="30%"
      draggable
      :before-close="hide_aak"
    >
      <span
        >确认删除( 姓名:<span
          v-text="form_aak.full_name"
        ></span
        >) 吗?</span
      >
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="hide_aak">取消</el-button>
          <el-button type="primary" @click="save_aak">提交</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data(){
    return{
      conf:{
        aah_visible:false,aai_visible:false,aak_visible:false,
      },
  //重置 form by  [y]
      form_aah:{full_name:"",
         },//解锁 form by  [y]
      form_aai:{full_name:"",
         },//删除 form by  [D]
      form_aak:{full_name:"",
         },
    }
  },
  methods:{//--------------------重置---------------------------------
      //显示 重置 弹出框
      show_aah(fm){
         Object.assign(this.form_aah,fm)
         this.conf.aah_visible = true;
      },
      //隐藏 重置 弹出框
      hide_aah(){
        this.conf.aah_visible = false;
        this.$refs.fm_aah.resetFields();
      },
      //保存 重置 弹出框数据
      save_aah(){
        let that = this
        
        this.$theia.http.post("/userinfo/reset",this.form_aah).then(res=>{
            that.$notify.success({title: '成功',message: '提交成功',duration:5000})
            that.$emit("onsaved")
            that.hide_aah()
        }).catch(res=>{
          let code = res.response.status
          let msg= `提交失败(${code})`
          that.$notify.error({title: '失败',message:msg,duration:5000})
        })
        
    },
    //-----------------------------------------------------------//--------------------解锁---------------------------------
      //显示 解锁 弹出框
      show_aai(fm){
         Object.assign(this.form_aai,fm)
         this.conf.aai_visible = true;
      },
      //隐藏 解锁 弹出框
      hide_aai(){
        this.conf.aai_visible = false;
        this.$refs.fm_aai.resetFields();
      },
      //保存 解锁 弹出框数据
      save_aai(){
        let that = this
        
        this.$theia.http.post("/userinfo/unlock",this.form_aai).then(res=>{
            that.$notify.success({title: '成功',message: '提交成功',duration:5000})
            that.$emit("onsaved")
            that.hide_aai()
        }).catch(res=>{
          let code = res.response.status
          let msg= `提交失败(${code})`
          that.$notify.error({title: '失败',message:msg,duration:5000})
        })
        
    },
    //-----------------------------------------------------------//--------------------删除---------------------------------
      //显示 删除 弹出框
      show_aak(fm){
         Object.assign(this.form_aak,fm)
         this.conf.aak_visible = true;
      },
      //隐藏 删除 弹出框
      hide_aak(){
        this.conf.aak_visible = false;
        this.$refs.fm_aak.resetFields();
      },
      //保存 删除 弹出框数据
      save_aak(){
        let that = this
        this.$theia.http.del("/userinfo",this.form_aak).then(res=>{
          that.conf.confirmVisible = false 
          that.$notify.success({title: '成功',message: '删除成功',duration:5000})
          that.$emit("onsaved")
          that.hide_aak()
       }).catch(err=>{
          that.conf.confirmVisible = false
          let code = res.response.status
          let msg= `删除失败(${code})`
          that.$notify.error({title: '失败',message:msg,duration:5000})
       })
    },
    //-----------------------------------------------------------
  },
  
}
</script>